home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectInput / DIConfig / ltrace.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  1.0 KB  |  64 lines

  1. #ifndef __LTRACE_H__
  2. #define __LTRACE_H__
  3.  
  4.  
  5. #define NO_LTRACE
  6.  
  7.  
  8. /*#ifndef NO_LTRACE
  9. #ifdef NDEBUG
  10. #error I want ltrace!
  11. #define NO_LTRACE
  12. #endif
  13. #endif*/
  14.  
  15.  
  16. #ifndef NO_LTRACE
  17.  
  18.  
  19. #ifndef THIS_FILE
  20. const TCHAR THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23.  
  24. class __CLTraceScope
  25. {
  26. public:
  27.     __CLTraceScope(LPCTSTR, LPCTSTR, int);
  28.     __CLTraceScope(LPCTSTR, int);
  29.     ~__CLTraceScope();
  30.  
  31.     void scope(LPCTSTR, ...);
  32.     void ltrace(LPCTSTR, ...);
  33.  
  34. private:
  35.     LPCTSTR spacing();
  36.     LPCTSTR m_scope, m_file;
  37.     int m_line;
  38.     int m_depth;
  39.     static int s_depth;
  40. //    __CLTraceScope *m_pprev, *m_pnext;
  41. //    static __CLTraceScope *s_pfirst, *s_plast;
  42. };
  43.  
  44.  
  45. #define LTSCOPE0(scope) __CLTraceScope __localscope(scope, THIS_FILE, __LINE__)
  46. #define LTSCOPE __CLTraceScope __localscope(THIS_FILE, __LINE__); __localscope.scope
  47. #define LTRACE __localscope.ltrace
  48.  
  49.  
  50. #else
  51.  
  52.  
  53. inline void __localscope_dummy(LPCTSTR, ...) {}
  54.  
  55. #define LTSCOPE0(scope) (void(0))
  56. #define LTSCOPE ; __localscope_dummy
  57. #define LTRACE __localscope_dummy
  58.  
  59.  
  60. #endif
  61.  
  62.  
  63. #endif //__LTRACE_H__
  64.